<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.ejoysoft.common.Constants,
				com.ejoysoft.util.ParamUtil,
				com.ejoysoft.wlanyz.system.SignalPara,
				com.ejoysoft.common.*,
				com.ejoysoft.wlanyz.business.Ac,
				java.io.File,
				java.util.Vector,
				java.math.*"%>
<%@ include file="../include/jsp/head.jsp"%>
<%	

try{

	if(action.equals(Constants.DELETE_STR)){
		SignalPara obj=new SignalPara(globa,false);
	
	    String strUrl="signalpara_list.jsp";
     	String[] aryStrId = ParamUtil.getStrArray(request, "strId");
    	for (int i = 0; i < aryStrId.length; i++) {
 			System.out.println("++++++++++"+aryStrId[i]);
    		globa.dispatch(obj.delete("where strId ='"+aryStrId[i]+"'"), strUrl); 	
		} 
	}
	else{	
	    SignalPara obj=new SignalPara(globa,false);	
	    String strUrl="signalpara_list.jsp";
	    ApacheUpload au = new ApacheUpload(request);
		action = au.getString(Constants.ACTION_TYPE);
		
	    
	    SignalPara obj0 = null;
	   if(action.equals(Constants.UPDATE_STR)){
			obj.setStrId(au.getString("strId"));
	    	obj0 = obj.show(" where strId='" + obj.getStrId() + "'");
	    }
	  
	    //赋值
	 //  
	      obj.setStrId(au.getString("strId"));
	      obj.setParaName(au.getString("ParaName"));
	      obj.setParaValue(Double.valueOf(au.getString("ParaValue")));
	 	//System.out.println("oooooooo"+ParamUtil.getString(request,"strId")+Integer.parseInt(ParamUtil.getString(request,"lineNum","0"))+Integer.parseInt(ParamUtil.getString(request,"drawNum","0"))+Integer.parseInt(ParamUtil.getString(request,"maxBlock","0")));
	    if(action.equals(Constants.ADD_STR)) { 
	    SignalPara obj1 = new  SignalPara(globa);  
	    String where = "  where para_name = '"+obj.getParaName()+"'";  
	    Vector<SignalPara> vctObj = obj1.list(where,0,0); 
	    if(vctObj.size()>0){globa.dispatch(false, strUrl, "该参数已经存在，不能继续添加！");}
	    else
	        globa.dispatch(obj.add(),strUrl);   
		}
		else if(action.equals(Constants.UPDATE_STR)) {
		        String strId=au.getString("strId");   
	        	globa.dispatch(obj.update(strId),strUrl);
	        }	
   }   
		
    //关闭数据库连接对象
    globa.closeCon();
   }catch(Exception e)
   {
   		e.printStackTrace();
   	}
%>